<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('shop/layout/headerMenu'); ?>
        </div>
    </div>
</div>
</div>
<div class="container breadcrumbs">
    <a href="<?php echo $this->url('shop'); ?>"><?php echo $this->translate('首页'); ?></a>
    <span class="sep">/</span><span><?php echo $this->translate('订单详情'); ?></span>
</div>
<div class="container">
    <div class="uc-full-box">
        <div class="row">
            <div class="span4">
                <?php echo $this->partial('shop/partial/home/leftMenu'); ?>
            </div>
            <div class="span16">
                <div class="xm-line-box uc-box uc-order-detail-box">
                    <div class="box-hd">
                        <h3 class="title">
                            <?php echo $this->translate('订单编号'); ?>：<?php echo $this->orderInfo->getOrderSn(); ?>
                        </h3>
                        <div class="more">
                            <?php echo $this->translate('订单状态'); ?>：<?php echo $this->shopHelper()->getOrderStatus($this->orderInfo->getOrderStatus()); ?>
                            <?php if($this->orderInfo->getOrderStatus() == $this->shopHelper()->getOrderStatusCode('wait_payment') && $this->orderInfo->getPaymentType() != 'CashOnDelivery') { ?>
                                <a href="<?php echo $this->url('shop-checkout', ['action' => 'checkoutComplete', 'id' => $this->orderInfo->getOrderId()]); ?>" class="btn btn-primary btn-small"><?php echo $this->translate('立即付款'); ?></a>
                            <?php } ?>
                            <a href="<?php echo $this->url('home-order'); ?>" class="btn btn-primary btn-small"><?php echo $this->translate('返回订单列表'); ?></a>
                        </div>
                    </div>
                    <div class="box-bd">
                        <div class="order-detail-tables">
                            <table class="order-detail-table">
                                <?php if($this->orderInfo->getDeliveryMode() == 1) { ?>
                                <thead>
                                <tr>
                                    <th colspan="5" class="column-info">
                                        <div class="column-content">
                                            <?php echo $this->translate('快递单号'); ?>：<?php echo $this->escapeHtml($this->orderInfo->getExpressNumber()); ?>
                                        </div>
                                    </th>
                                </tr>
                                </thead>
                                <?php } ?>
                                <tbody>
                                <?php
                                foreach($this->orderInfo->getOrderGoods() as $goodsValue) {
                                    $goodsName = $this->escapeHtml($goodsValue->getGoodsName());
                                    ?>
                                    <tr>
                                        <td class="column-detail">
                                            <?php if($goodsValue->getDeliveryId() > 0) { ?><small class="bg-primary" style="padding: 3px;border-radius:3px;"><?php echo $this->translate('快递信息').'：'.$this->escapeHtml($goodsValue->getDeliveryName()).'&nbsp;&nbsp;'.$this->translate('快递单号').'：'.$this->escapeHtml($goodsValue->getExpressNumber()); ?></small><?php } ?>
                                            <ul class="order-goods-list">
                                                <li class="first">
                                                    <a href="<?php echo $this->url('shop-goods', ['id'=>$goodsValue->getGoodsId()]); ?>" target="_blank"><img alt="<?php echo $this->escapeHtml($goodsName); ?>" src="<?php echo $this->shopHelper()->baseGoodsImagePath($goodsValue->getGoodsImage()); ?>" class="goods-thumb"></a>
                                                    <a class="goods-name" href="<?php echo $this->url('shop-goods', ['id'=>$goodsValue->getGoodsId()]); ?>" target="_blank"><?php echo $this->escapeHtml($goodsName); ?></a>
                                                    <span class="goods-price"><?php echo $this->shopHelper()->orderCurrency($goodsValue->getGoodsPrice(), $this->orderInfo->getCurrencySymbol()); ?></span>
                                                    <span class="goods-amount">x <?php echo $goodsValue->getBuyNum(); ?></span>
                                                </li>
                                            </ul>
                                        </td>
                                        <td class="column-price">
                                            <div class="order-info order-price"><?php echo $this->escapeHtml($goodsValue->getGoodsItem());?></div>
                                        </td>
                                        <td class="column-date">
                                            <?php echo $this->escapeHtml($goodsValue->getInSpecGoodsStr()); ?>
                                        </td>
                                        <td class="column-action">
                                            <strong><?php echo $this->shopHelper()->orderCurrency($goodsValue->getGoodsAmount(), $this->orderInfo->getCurrencySymbol()); ?></strong>
                                        </td>
                                        <td class="column-action">
                                            <?php
                                            if (
                                            $this->orderInfo->getOrderStatus() >= $this->shopHelper()->getOrderStatusCode('GOODS_RECEIVED')
                                            && $this->shopHelper()->shop('order_return', 'order') == 1
                                            && $goodsValue->getGoodsType() == 1
                                            && time() < $this->orderInfo->getOrderFinishTime() + $this->shopHelper()->shop('order_return_limit', 'order') * 86400
                                            ) { ?>
                                                <a href="<?php echo $this->url('shop-service', ['id' => $goodsValue->getOrderGoodsId()]) ?>" style="color: #fff;border:1px;margin-bottom: 5px;" target="_blank" class="btn btn-small btn-primary"><?php echo $this->translate('申请售后'); ?></a>
                                            <?php } ?>
                                            <button class="btn btn-small" onclick="window.location.href='<?php echo $this->url('shop-goods', ['id' => $goodsValue->getGoodsId()]); ?>'"><?php echo $this->translate('再次购买'); ?></button>
                                        </td>
                                    </tr>
                                <?php } ?>
                                <tr>
                                    <td colspan="5" class="column-delivery">
                                        <div class="order-delivery-status">
                                            <ol class="order-delivery-steps clearfix">
                                                <li class="step step-first step-now">
                                                    <div class="progress">
                                                        <span class="text"><?php echo $this->translate('下单时间'); ?></span>
                                                    </div>
                                                    <div class="info"><?php echo $this->shopDateFormat()->orderTime($this->orderInfo->getOrderAddTime()); ?></div>
                                                </li>
                                                <li class="step <?php if(!empty($this->orderInfo->getPaymentFinishTime())) echo 'step-now'; ?>">
                                                    <div class="progress">
                                                        <span class="text"><?php echo $this->translate('付款时间'); ?></span>
                                                    </div>
                                                    <div class="info">
                                                        <?php if(!empty($this->orderInfo->getPaymentFinishTime())) echo $this->shopDateFormat()->orderTime($this->orderInfo->getPaymentFinishTime());; ?>
                                                    </div>
                                                </li>
                                                <li class="step <?php if($this->orderInfo->getDeliveryType() != 'selfFetch' && !empty($this->orderInfo->getExpressTime())) echo 'step-now'; ?>">
                                                    <div class="progress">
                                                        <span class="text"><?php echo $this->translate('发货时间'); ?></span>
                                                    </div>
                                                    <div class="info">
                                                        <?php if($this->orderInfo->getDeliveryType() != 'selfFetch' && !empty($this->orderInfo->getExpressTime())) echo $this->shopDateFormat()->orderTime($this->orderInfo->getExpressTime()); ?>
                                                    </div>
                                                </li>
                                                <li class="step step-last <?php if(!empty($this->orderInfo->getOrderFinishTime())) echo 'step-now'; ?>">
                                                    <div class="progress">
                                                        <span class="text"><?php echo $this->translate('完成时间'); ?></span>
                                                    </div>
                                                    <div class="info">
                                                        <?php if(!empty($this->orderInfo->getOrderFinishTime())) echo $this->shopDateFormat()->orderTime($this->orderInfo->getOrderFinishTime()); ?>
                                                    </div>
                                                </li>
                                            </ol>
                                        </div>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="order-detail-total clearfix">
                                <?php if ($this->integral && $this->integral->getIntegralType1Num() > 0) { ?>
                                    <p style="text-align: right;margin-bottom: 10px;"><?php echo $this->translate('消费积分'); ?>(<?php echo $this->translate('确认收货后得到积分'); ?>)：<font size="4" color="#ff4a00"><?php echo $this->integral->getIntegralType1Num(); ?><?php echo $this->translate('积分'); ?></font></p>
                                <?php } ?>
                                <?php if ($this->integral && $this->integral->getIntegralType2Num() > 0) { ?>
                                    <p style="text-align: right;margin-bottom: 10px;"><?php echo $this->translate('等级积分'); ?>(<?php echo $this->translate('确认收货后得到积分'); ?>)：<font size="4" color="#ff4a00"><?php echo $this->integral->getIntegralType2Num(); ?><?php echo $this->translate('积分'); ?></font></p>
                                <?php } ?>
                                <dl class="total-list">
                                    <?php if ($this->orderInfo->getOrderWeightAmount() > 0) { ?>
                                        <dt><?php echo $this->translate('商品总重量'); ?>：</dt>
                                        <dd><?php echo ($this->orderInfo->getOrderWeightAmount()/1000).$this->translate('千克'); ?></dd>
                                    <?php } ?>
                                    <dt><?php echo $this->translate('商品总计'); ?>：</dt>
                                    <dd><?php echo $this->shopHelper()->orderCurrency($this->orderInfo->getGoodsAmount(), $this->orderInfo->getCurrencySymbol()); ?></dd>
                                    <?php if ($this->orderDiscountRecord) foreach ($this->orderDiscountRecord as $recordValue) { ?>
                                    <dt><?php echo $recordValue->getDiscountInfo(); ?>：</dt>
                                    <dd>-<?php echo $this->shopHelper()->orderCurrency($recordValue->getDiscountCost(), $this->orderInfo->getCurrencySymbol()); ?></dd>
                                    <?php } ?>
                                    <dt><?php echo $this->translate('配送费用'); ?>：</dt>
                                    <dd><?php echo $this->shopHelper()->orderCurrency($this->orderInfo->getShippingFee(), $this->orderInfo->getCurrencySymbol()); ?></dd>
                                    <dt><?php echo $this->translate('订单总额'); ?>：</dt>
                                    <dd><b><?php echo $this->shopHelper()->orderCurrency($this->orderInfo->getOrderAmount(), $this->orderInfo->getCurrencySymbol()); ?></b></dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="order-delivery-address">
                        <div class="order-text-section">
                            <h4><?php echo $this->translate('支付信息'); ?></h4>
                            <table class="order-text-table" width="100%">
                                <tbody>
                                <tr>
                                    <th><?php echo $this->translate('付款方式'); ?>：</th>
                                    <td><?php echo $this->shopHelper()->getPaymentTypeName($this->orderInfo->getPaymentType()); if(!empty($this->orderInfo->getPaymentName())) echo '-'.$this->orderInfo->getPaymentName(); ?></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <?php if ($this->orderInfo->getDeliveryType() == 'selfFetch') { ?>
                        <div class="order-text-section">
                            <h4><?php echo $this->translate('自提信息'); ?> </h4>
                            <table class="order-text-table" width="100%">
                                <tbody>
                                <tr>
                                    <th><?php echo $this->translate('自提点名称'); ?>：</th>
                                    <td><?php echo $this->escapeHtml($this->orderSelfLocation->getLocationName()); ?></td>
                                </tr>
                                <tr>
                                    <th><?php echo $this->translate('自提点地址'); ?>：</th>
                                    <td><?php echo $this->escapeHtml($this->orderSelfLocation->getRegionInfo() . $this->orderSelfLocation->getLocationAddress()); ?></td>
                                </tr>
                                <tr>
                                    <th><?php echo $this->translate('联系人'); ?>：</th>
                                    <td><?php echo $this->escapeHtml($this->orderSelfLocation->getLocationUser()); ?></td>
                                </tr>
                                <tr>
                                    <th><?php echo $this->translate('联系电话'); ?>：</th>
                                    <td><?php echo $this->escapeHtml($this->orderSelfLocation->getLocationPhone()); ?></td>
                                </tr>
                                <tr>
                                    <th><?php echo $this->translate('营业时间'); ?>：</th>
                                    <td><?php echo $this->escapeHtml($this->orderSelfLocation->getLocationBusinessHours()); ?></td>
                                </tr>
                                <?php if (!empty($this->orderSelfLocation->getTakeCode())) { ?>
                                <tr>
                                    <th><?php echo $this->translate('提货码'); ?>：</th>
                                    <td>
                                        <p style="font-size: 25px;"><?php echo $this->orderSelfLocation->getTakeCode(); ?></p>
                                        <p><img src="<?php echo $this->url('shop/default', ['action' => 'shopQrCodeFile'], ['query' => ['qToken' => $this->shopHelper()->getCsrfValue(), 'data' => $this->orderSelfLocation->getTakeCode()]]); ?>"></p>
                                    </td>
                                </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>
                        <?php } elseif ($this->orderDeliveryAddress) { ?>
                            <div class="order-text-section">
                                <h4><?php echo $this->translate('配送信息'); ?> </h4>
                                <table class="order-text-table" width="100%">
                                    <tbody>
                                    <?php
                                    if (
                                    $this->orderInfo->getOrderStatus() >= $this->shopHelper()->getOrderStatusCode('GOODS_RECEIVED')
                                    && $this->orderInfo->getDeliveryType() == 'delivery'
                                    && $this->shopHelper()->getDeliveryTrackState() == 1
                                    && (
                                        ($this->orderInfo->getDeliveryId() > 0 && !empty($this->deliveryIdArray) && isset($this->deliveryIdArray[$this->orderInfo->getDeliveryId()]))
                                        || $this->orderInfo->getDeliveryId() <= 0
                                    )
                                    ) { ?>
                                    <tr>
                                        <th><?php echo $this->translate('物流轨迹'); ?>：</th>
                                        <td><a href="<?php echo $this->url('home-order', ['action' => 'orderExpressTrack', 'id' => $this->orderInfo->getOrderId()]); ?>" target="_blank" class="btn btn-small btn-primary" style="width: 116px;color: #fff;text-decoration: none;"><?php echo $this->translate('点击查看物流轨迹'); ?></td>
                                    </tr>
                                    <?php } ?>
                                    <tr>
                                        <th><?php echo $this->translate('收货人员'); ?>：</th>
                                        <td><?php echo $this->escapeHtml($this->orderDeliveryAddress->getTrueName()); ?></td>
                                    </tr>
                                    <?php if($this->orderInfo->getDeliveryMode() == 1) { ?>
                                    <tr>
                                        <th><?php echo $this->translate('快递信息'); ?>：</th>
                                        <td><?php echo $this->escapeHtml($this->orderInfo->getDeliveryName()); ?></td>
                                    </tr>
                                        <tr>
                                            <th><?php echo $this->translate('快递单号'); ?>：</th>
                                            <td><?php echo $this->escapeHtml($this->orderInfo->getExpressNumber()); ?></td>
                                        </tr>
                                    <?php } ?>
                                    <tr>
                                        <th><?php echo $this->translate('收货地址'); ?>：</th>
                                        <td><?php echo $this->escapeHtml($this->orderDeliveryAddress->getRegionValue() . $this->orderDeliveryAddress->getAddressInfo()); ?></td>
                                    </tr>
                                    <?php if($this->orderDeliveryAddress->getPostCode()) { ?>
                                        <tr>
                                            <th><?php echo $this->translate('邮政编码'); ?>：</th>
                                            <td><?php echo $this->escapeHtml($this->orderDeliveryAddress->getPostCode()); ?></td>
                                        </tr>
                                    <?php } ?>
                                    <tr>
                                        <th><?php echo $this->translate('联系电话'); ?>：</th>
                                        <td><?php echo $this->escapeHtml($this->orderDeliveryAddress->getPhone()); ?></td>
                                    </tr>
                                    <?php if(!empty($this->orderInfo->getOrderMessage())) { ?>
                                        <tr>
                                            <th><?php echo $this->translate('买家留言'); ?>：</th>
                                            <td><?php echo nl2br($this->escapeHtml($this->orderInfo->getOrderMessage())); ?></td>
                                        </tr>
                                    <?php } ?>
                                    </tbody>
                                </table>
                            </div>

                            <?php if(!empty($this->orderDeliveryAddress->getDeliveryTimeInfo())) { ?>
                                <div class="order-text-section">
                                    <h4><?php echo $this->translate('送货时间'); ?> </h4>
                                    <div class="order-text-section">
                                        <div class="order-delivery-time" id="timeSection"><?php echo $this->escapeHtml($this->orderDeliveryAddress->getDeliveryTimeInfo()); ?></div>
                                    </div>
                                </div>
                            <?php } } ?>
                    </div>

                    <div class="box-bd">
                        <div class="order-detail-tables">
                            <h4><?php echo $this->translate('订单记录'); ?></h4>
                            <table class="order-detail-table">
                                <thead>
                                <tr>
                                    <th class="column-info" style="padding-left: 5px;" width="25%"><?php echo $this->translate('订单日期'); ?></th>
                                    <th class="column-info" style="text-align: center;" width="15%"><?php echo $this->translate('订单状态'); ?></th>
                                    <th class="column-info" style="text-align: center;"><?php echo $this->translate('备注'); ?></th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php if($this->orderStatus) foreach ($this->orderStatus as $statusValue) { ?>
                                    <tr>
                                        <td style="height: 36px;padding-left: 5px;"><?php echo $this->shopDateFormat()->shopOrderStatusTime($statusValue->getStatusTime()); ?></td>
                                        <td style="text-align: center;"><?php echo $this->shopHelper()->getOrderStatus($statusValue->getOrderStatus()); ?></td>
                                        <td style="padding-left: 5px;"><?php echo $this->escapeHtml($statusValue->getStatusInfo()); ?></td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>